
#ifndef PICDEM_FS_DEMO_H
#define PICDEM_FS_DEMO_H

/** I N C L U D E S **********************************************************/
#include "GenericTypeDefs.h"
#include "usb_config.h"

extern volatile unsigned char usbgen_out[USBGEN_EP_SIZE];
extern volatile unsigned char usbgen_in[USBGEN_EP_SIZE];

/** D E F I N I T I O N S ****************************************************/
/* PICDEM FS USB Demo Version */
#define MINOR_VERSION   0x00    //Demo Version 1.00
#define MAJOR_VERSION   0x01

/* Temperature Mode */
#define TEMP_REAL_TIME  0x00
#define TEMP_LOGGING    0x01


/** S T R U C T U R E S ******************************************************/
typedef union _DATA_PACKET
{
    BYTE _byte[USBGEN_EP_SIZE];  //For byte access
    WORD _word[USBGEN_EP_SIZE/2];//For word access(USBGEN_EP_SIZE msut be even)
    struct
    {
        enum
        {
            READ_VERSION    = 0x00,
            READ_PROPS      = 0x01,
            AUTOHOLD        = 0x02,

            INITWRITE       = 0x03,
            WRITERAM        = 0x04,
            STARTGEN        = 0x05,
            MANCLK          = 0x06,
            FPGAHARDRESET   = 0x07,

            SETDAC          = 0x08,
            SETFREQ         = 0x09,

            SETSWEEP        = 0x0A,
            RESET           = 0xFF
        }CMD;
        BYTE Len;
        BYTE Data[USBGEN_EP_SIZE-2];
    } DP;
} DATA_PACKET;

/** P U B L I C  P R O T O T Y P E S *****************************************/
void UserInit(void);
void ProcessIO(void);
void ProcessSweep(void);

#endif //PICDEM_FS_DEMO_H
